package org.example;

import java.math.BigDecimal;

/**
 * @Title : BigDecimalDivide
 * @Description:
 * @author: libo@juzishuke.com
 * @date: 2023/12/6 15:09
 * @Version:1.0
 */
public class BigDecimalDivide {

    public static void main(String[] args) {
        BigDecimal b20 = BigDecimal.valueOf(20L);
        BigDecimal b1000 = BigDecimal.valueOf(1000L);
        System.out.println(b20.divide(b1000, BigDecimal.ROUND_HALF_UP)); // 0
        System.out.println(b20.divide(b1000, 1, BigDecimal.ROUND_HALF_UP)); // 0
        System.out.println(b20.divide(b1000, 2, BigDecimal.ROUND_HALF_UP)); // 0.20
        System.out.println(b20.divide(b1000, 3, BigDecimal.ROUND_HALF_UP)); // 0.20
        System.out.println(b20.divide(b1000, 4, BigDecimal.ROUND_HALF_UP)); // 0.20
    }

}
